package com.example.wanandroid.mapper;

import com.example.wanandroid.pojo.User;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;

@Component
public interface UserMapper {
    int deleteByPrimaryKey(Long id);

    int insert(User user);

    int insertSelective(User user);

    User selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(User user);

    int updateByPrimaryKey(User user);

    @Select("SELECT * FROM tb_user")
    List<HashMap<String,Object>> getUsers();

    /**
     * 根据用户名查询用户信息
     * @param username
     * @return
     */
    @Select("select * from tb_user where username=#{username} limit 1")
    User selectUserByUsername(String username);

}